/*
* acooly.cn Inc.
* Copyright (c) 2017 All Rights Reserved.
* create by ouwen
* date:2017-09-20
*/
package com.yiji.fintech.musfinance.web;

import com.acooly.core.common.web.AbstractJQueryEntityController;
import com.yiji.fintech.musfinance.common.enums.StatusEnum;
import com.yiji.fintech.musfinance.common.enums.TrustModelEnum;
import com.yiji.fintech.musfinance.common.utils.cache.CacheConstant;
import com.yiji.fintech.musfinance.common.utils.cache.CacheService;
import com.yiji.fintech.musfinance.entity.BusinessConfig;
import com.yiji.fintech.musfinance.service.BusinessConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * center_business_config 管理控制器
 * 
 * @author ouwen
 * Date: 2017-09-20 22:13:11
 */
@Controller
	@RequestMapping(value = "/manage/businessconfig/businessConfig")
public class BusinessConfigManagerController extends AbstractJQueryEntityController<BusinessConfig, BusinessConfigService> {
	

	{
		allowMapping = "*";
	}

	@SuppressWarnings("unused")
	@Autowired
	private BusinessConfigService businessConfigService;
	@Autowired
	private CacheService cacheService;

	@Override
	protected BusinessConfig doSave(HttpServletRequest request, HttpServletResponse response, Model model, boolean isCreate) throws Exception {
		BusinessConfig businessConfig = super.doSave(request, response, model, isCreate);
		cacheService.doUpdateMutiCache(CacheConstant.CENTER_BUSINESS_CONFIG_MUTICACHE,BusinessConfigService.class);//更新接入能力多级缓存
		return businessConfig;
	}

	@Override
	protected void referenceData(HttpServletRequest request, Map<String, Object> model) {
		model.put("allStatuss", StatusEnum.mapping());
		model.put("allTrusts", TrustModelEnum.mapping());
	}

}
